package com.zfei.gfb.request;

import cn.hutool.core.lang.Validator;
import com.zfei.gfb.util.ObjUtil;
import com.zfei.gfb.bean.Status;
import com.zfei.gfb.bean.StatusException;
import io.swagger.annotations.ApiModelProperty;


/**
 * @author fgh
 */
public class GfbBannerEditRequest {

    // id
    @ApiModelProperty(value = "banner id", required = true)
    private Integer id;
    // 图片地址
    @ApiModelProperty(value = "图片地址", required = true)
    private String image;
    // 跳转url
    @ApiModelProperty(value = "跳转url", required = true)
    private String redirectUrl;

    public void setId(Integer value) {
        this.id = value;
    }

    public Integer getId() {
        return this.id;
    }

    public void setImage(String value) {
        this.image = value;
    }

    public String getImage() {
        return this.image;
    }

    public void setRedirectUrl(String value) {
        this.redirectUrl = value;
    }

    public String getRedirectUrl() {
        return this.redirectUrl;
    }

    public void checkUpdateNull() {
        if (ObjUtil.anyNull(id, image, redirectUrl)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
        if (!Validator.isUrl(image)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
        if (!Validator.isUrl(redirectUrl)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
    }
}

